﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using ProjectWebNhac.DAO;
using ProjectWebNhac.DTO;

namespace ProjectWebNhac.BUS
{
    public class BinhLuanAlbumBus
    {
        Dataprovider dao = new Dataprovider();
        public DataTable LayListBinhLuan(int MaAlbum)
        {
            object[] para = { "@MaAlbum", MaAlbum };
            return dao.LayDuLieuThamSo("sp_User_LayBinhLuanAlbumTheoMaALbum", CommandType.StoredProcedure, para);
        }

        public DataTable LayChiTietBinhLuan(int MaBinhLuan)
        {
            object[] para = { "@MaBinhLuan", MaBinhLuan };
            return dao.LayDuLieuThamSo("sp_Admin_LayBinhLuanAlbumTheoMaBinhLuan", CommandType.StoredProcedure, para);
        }

        public bool ThemBinhLuan(BinhLuanAlbumDTO objBinhLuan)
        {
            return dao.XuLySuKien("sp_User_ThemBinhLuanAlbum", CommandType.StoredProcedure,
                new Object[] {"@taikhoan",objBinhLuan.TaiKhoan,"@LoiBinh",
                objBinhLuan.LoiBinh,"@MaBaiHat",objBinhLuan.MaAlbum});
        }
        
        public DataTable LayHetListBinhLuan( )
        {
            return dao.LayDuLieuThamSo("sp_User_LayBinhLuanAlbum", CommandType.StoredProcedure);
        }

        public bool XoaBinhLuan( int MaBinhLuan)
        {
            return dao.XuLySuKien("sp_Admin_XoaBinhLuanAlbum", CommandType.StoredProcedure,
                new Object[] { "@MaBinhLuan", MaBinhLuan });
        }
    }
}